const mongoose = require('mongoose');
const ProductSchema = mongoose.Schema({
    // 表规则
    title: {
        type: String,
        required: [true, "商品的名称不能为空"],
        trim: true
    },
    // 一级分类
    cate_id: {
        type: String
    },
    // 二级分类
    goods_id: {
        type: String
    },
    // 缩略图
    pic: {
        type: String
    },
    price: {
        type: Number
    },
    // 邮费
    fee: {
        type: Number
    },
    description: {
        type: String
    }
});

// 创建表
const Product = mongoose.model('product', ProductSchema);

module.exports = Product;